<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>员工信息列表</title>
        <link rel="stylesheet" href="./css/list.css"/>
    </head>
    <body>
        <div id="con">
            <h1>添加员工</h1>
            <form action="empadd.php" method="post">
                <table width="90%" > 
                                
                    <tr>
                        <th>姓名</th>
                        <td><input type="text" name="e_name" placeholder="请输入姓名" class="txt"/></td>
                    </tr>
                    <tr>
                        <th>所属部门</th>
                        <td><input type="text" name="e_dept" placeholder="请输入部门"class="txt"/></td>
                    </tr>
                    <tr>
                        <th>头像</th>
                    	<td>
                        <input type="radio" name="e_img" value="images/1.jpg" checked="checked" /><img src=" images/1.jpg" alt="" height="80px" width="80px" />
                        <input type="radio" name="e_img" value="images/2.jpg" /><img src=" images/2.jpg" alt="" height="80px" width="80px" />
                        <input type="radio" name="e_img" value="images/3.jpg" /><img src=" images/3.jpg" alt="" height="80px" width="80px" />
                        <input type="radio" name="e_img" value="images/4.jpg" /><img src=" images/4.jpg" alt="" height="80px" width="80px" />
                        </td>
                    </tr>
                    <tr>
                        <th>出生日期</th>
                        <td><input type="datetime-local" name="date_of_birth"/></td>
                    </tr>
                    <tr>
                    <th>入职日期</th>
                    <td><input type="datetime-local" name="date_of_entry" /></td>
                    </tr>
                    <tr>
                        <th></th>
                        <td>
                            <input type="submit" value="添加员工"/>
                        </td>
                    </tr>
                    
                </table>
                
            </form>
            <h1>员工信息列表</h1>
            <table >
            <tr>
                  <form action="" method="get">
                          <input type="text" placeholder="请输入搜索关键字" name="search" value="<?php echo $search;  ?>"/>                    
                         <input type="submit" value="确定" />
                    </form>   
            </tr>
            
                <tr>
                    <th>ID</th>
                    <th>员工姓名</th>
                    <th>所属部门</th>
                    <th>员工头像</th>
                    <th>出生日期</th>
                    <th>入职日期</th>
                    <th>相关操作</th>
                </tr>
            <?php 
            foreach($emplist as $k)
            {
            ?>
                <tr>
                    <td><?php echo $k['e_id']?></td>
                    <td><?php echo $k['e_name']?></td>
                    <td><?php echo $k['e_dept']?></td>
                    <td><img src="<?php echo $k['e_img']?>" alt=""></td>
                    <td><?php echo $k['date_of_birth']?></td>
                    <td><?php echo $k['date_of_entry']?></td>
                    <td><a href="javascript:location.href='empdataup.php? e_id=<?php echo $k['e_id']?>'">修改</a>
                    <a href="javascript: "onClick="if (confirm('确定删除吗？')) location.href='empdele.php? e_id=<?php echo $k['e_id']?>'" >删除</a></td>
                </tr>
            <?php
            }
            ?>

            </table>
            <div class="search_but">
                <ul id="page" style="list-style: none;">
                    <?php
                    $pre=(($page-1)<=0)?1:($page-1);
                    $next=(($page+1)>$maxpage)?$maxpage:($page+1);
                    ?>
                    <li style="float: left;margin: 5px;padding: 5px;border: 1px solid #D5D9DC;"><a href="index.php?page=1">首页</a></li>
                    <li style="float: left;margin: 5px;padding: 5px;border: 1px solid #D5D9DC;"><a href="index.php?page=<?php echo $pre; ?>">上一页</a></li>
                    <li style="float: left;margin: 5px;padding: 5px;border: 1px solid #D5D9DC;"><a href="index.php?page=<?php echo $next; ?>">下一页</a></li>
                    <li style="float: left;margin: 5px;padding: 5px;border: 1px solid #D5D9DC;"><a href="index.php?page=<?php echo $maxpage; ?>">末页</a></li>
                    <li style="float: left;margin: 5px;padding: 5px;border: 1px solid #D5D9DC;"><?php echo "共".$maxpage."页当前".$page."页"; ?></li>
                </ul>
            </div>
        </div>
     
    </body>
</html>
